package cn.shop.msgs;

import com.fasterxml.jackson.annotation.JsonFormat;

import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author : 李一涵
 * @date : Created in 2021-12-17 13:58
 * @description :
 */
public class BaseMsg {

    /**
     * 业务主键，如订单编号，用户编号等
     */
    private List<Long> ids;
    /**
     * 发送消息时间
     */
    @JsonFormat
    private LocalDateTime time;

	public List<Long> getIds() {
		return ids;
	}

	public void setIds(List<Long> ids) {
		this.ids = ids;
	}

	public LocalDateTime getTime() {
		return time;
	}

	public void setTime(LocalDateTime time) {
		this.time = time;
	}

    @Override
    public String toString() {
        return "BaseMsg{" +
                "ids=" + ids +
                ", time=" + time +
                '}';
    }

    public BaseMsg id(long... id) {
        this.setIds(Arrays.stream(id).boxed().collect(Collectors.toList()));
        return this;
    }

    public BaseMsg time(LocalDateTime time) {
        this.time = time;
        return this;
    }
}
